home *** CD-ROM | disk | FTP | other *** search
/ CD Actual 27 / CDROM27.iso / share / progra / mai / Controls, TextBox - Setting to read-only < prev    next >
Encoding:
Text File  |  1997-07-15  |  677 b   |  18 lines

  1. Description: Sets a TextBox to read-only, prohibiting alteration to content
  2. '            set text1 to multi-line
  3.  
  4. 'Const WM_USER = &H400
  5. 'Const EM_SETREADONLY = (WM_USER + 31)
  6. 'Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" _
  7. (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Long) As Long
  8.  
  9.  
  10. Open "C:\CONFIG.SYS" For Input As #1
  11. While Not EOF(1)
  12.     Line Input #1, TmpStr$
  13.         KeepStr$ = KeepStr$ & TmpStr$ & Chr$(13) & Chr$(10)
  14. Wend
  15. text1.Text = KeepStr$
  16. ' Set the text box to read-only mode:
  17. ret& = SendMessage(text1.hWnd, EM_SETREADONLY, True, 0&)
  18. If ret& = 0 Then MsgBox "Couldn't Set Text Box to Read-Only."